<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <#include "../common/head.ftl"/>
    <script>
        $(function () {
            $(".changeBtn").click(function () {
                var json = $(this).data("json");
                var state = $(this).data("state");
                $.post("/travel/changeState.do",{id:json.id,state:state},function (data) {
                    if (data.success) {
                        window.location.reload();
                    }else{
                        $.messager.alert("温馨提示",data.msg);
                    }
                })
            })


            //查看文章的操作,使用类选择器不要使用id选择器
            $(".lookContent").click(function () {
                console.log("1");
                var json = $(this).data("json");
                console.log(json);
                $.post("/travel/showContent.do",{travelId:json.id},function (data) {

                    $("#showModal .modal-body").html(data.content);

                    $("#showModal").modal('show');
                })
            })
        })
    </script>


<#--这些样式是用来限定模态框里面的一些操作-->
    <style>
        #showModal img{
            width: 100%;
        }
        #showModal .modal-body{
            max-height: 500px;  /*//最大高度*/
            overflow-y: auto;  /* 超过最大高度,自动滚动*/
        }
    </style>
</head>
<body>



<!-- 查看文章的模态框（Modal） -->
<div class="modal fade" id="showModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">游记内容</h4>
            </div>
            <div class="modal-body">
            </div>
            <div class="modal-footer">
            </div>
        </div>
    </div>
</div>


<div class="container " style="margin-top: 20px">
    <#include "../common/top.ftl"/>
    <div class="row">
        <div class="col-sm-3">
            <#assign menu="travel"/>
            <#include "../common/menu.ftl"/>
        </div>
        <div class="col-sm-9">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">旅游管理</h1>
                </div>
            </div>
            <!--高级查询--->
            <form class="form-inline" id="searchForm" action="/travel/list.do" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">
                <div class="form-group">
                    <label>关键字:</label>
                    <input type="text" class="form-control" name="keyword" value="${(qo.keyword)!}"
                           placeholder="请输入标题">
                </div>

                <button id="btn_query" class="btn btn-info">
                    <span class="glyphicon glyphicon-search"></span> 查询
                </button>
            </form>


            <table class="table table-striped table-hover">
                <tr>
                    <th>标题</th>
                    <th>封面</th>
                    <th>地点</th>
                    <th>作者</th>
                    <th>状态</th>
                    <th></th>
                    <th></th>
                    <th></th>
                </tr>
                <#list pageInfo.list as entity>
                    <tr>
                        <td>${(entity.title)!}</td>
                        <td><img src="${(entity.coverUrl)!}" width="30px"></td>
                        <td>${(entity.place.name)!}</td>
                        <td>${(entity.author.nickName)!}</td>
                        <td>${(entity.getStateName())!}</td>
                        <td><a href="javascript:;" class="changeBtn" data-state="3" data-json='${entity.jsonString}'>发布</a></td>
                        <td><a href="javascript:;" class="changeBtn" data-state="0" data-json='${entity.jsonString}'>拒绝</a></td>
                        <td><a href="javascript:;" class="lookContent" data-json='${entity.jsonString}'>查看文章</a></td>
                    </tr>
                </#list>
            </table>
            <#include "../common/page.ftl"/>
        </div>
    </div>
</div>


</body>
</html>